﻿<UserControls:ScrumUserControl 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"	
    xmlns:CustomControl1="clr-namespace:ScrumTable.UI.View.CustomControl;assembly=ScrumTable.UI.View" 
    xmlns:Converter="clr-namespace:ScrumTable.UI.View.Converter;assembly=ScrumTable.UI.View" xmlns:loc="clr-namespace:ScrumTable.UI.View.Localization;assembly=ScrumTable.UI.View"
	xmlns:Controls="clr-namespace:Microsoft.Surface.Presentation.Controls;assembly=Microsoft.Surface.Presentation"
	xmlns:UserControls="clr-namespace:ScrumTable.UI.View.WinTouch.UserControls"
	xmlns:Toast="clr-namespace:ScrumTable.UI.View.WinTouch.UserControls.Tool.Toast"
	x:Class="ScrumTable.UI.View.WinTouch.UserControls.Tool.Toast.ToastPublisherControl" Width="385"
    x:Name="UserControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <UserControls:ScrumUserControl.Resources>
        <Converter:ConverterListCountVisibility x:Key="ConvertIntToVisible"/>            

        <DataTemplate x:Key="ErrorToastTemplate">
            <Toast:ErrorToast/>
        </DataTemplate>       
        
        <Toast:ToastItemTemplateSelector x:Key="contentTemplateSelector" ErrorTemplate="{StaticResource ErrorToastTemplate}"/>
    </UserControls:ScrumUserControl.Resources>
    
    <UserControls:ScrumUserControl.Visibility>
        <Binding Path="Toasts.Count" Converter="{StaticResource ConvertIntToVisible}"></Binding>
    </UserControls:ScrumUserControl.Visibility>
    
    <Grid>
        <Grid.RowDefinitions>            
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <ItemsControl ItemsSource="{Binding Toasts}" IsTabStop="False" Margin="0,0,0,0"  Grid.Row="0" HorizontalAlignment="Stretch"  ItemTemplateSelector="{StaticResource contentTemplateSelector}"  >            
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <CustomControl1:StackPanelAnimated Orientation="Vertical" AnimateFromBottom="True"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>                   
        </ItemsControl>        
    </Grid>
</UserControls:ScrumUserControl>    